<?php

namespace Ipartek\BlogBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\SecurityContext;

/**
 * Usuario controller.
 *
 */
class UsuarioController extends Controller
{
    /**
     * Pagina de bienvenida al usuario.
     *
     */
    public function indexAction()
    {
        return $this->render('IpartekBlogBundle:Usuario:index.html.twig');
    }  

    public function loginAction()
    {
    	$peticion = $this->getRequest();
    	$sesion = $peticion->getSession();
    	$error = $peticion->attributes->get(
    			SecurityContext::AUTHENTICATION_ERROR,
    			$sesion->get(SecurityContext::AUTHENTICATION_ERROR)
    	);
    	return $this->render('IpartekBlogBundle:Usuario:login.html.twig', array(
    			'last_username' => $sesion->get(SecurityContext::LAST_USERNAME),
    			'error' => $error
    	));
    }
}
